package com.park.platform.task;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * 仅Spring容器加载时执行
 * Created by Administrator on 2016/1/4.
 */
public class TokenInstantiationTracingBeanPostProcessor implements ApplicationListener<ContextRefreshedEvent> {

    private static final Logger logger = Logger.getLogger(TokenInstantiationTracingBeanPostProcessor.class);

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {

        if(event.getApplicationContext().getParent() == null){//root application context初始化完成后调用逻辑代码，其他的容器的初始化完成，则不做任何处理
            //需要执行的逻辑代码，当spring容器初始化完成后就会执行该方法。
            logger.info(">>>>>>>>>>>>>>>>>TokenInstantiationTracingBeanPostProcessor");
        }

    }
}
